package cn.swust.designpatternlearningplatform.domain.bo;

import java.util.ArrayList;
import java.util.List;
/**
 * @author wang
 * description 节点类
 * date 2023/4/18 22:00
 */
public class NodeBo {
    private int id;
    private String name;
    private List<NodeBo> children;

    public NodeBo(int id, String name) {
        this.id = id;
        this.name = name;
        this.children = new ArrayList<>();
    }

    public int getId() {
        return id;
    }
    public String getName() {
        return name;
    }
    //获取孩子节点
    public List<NodeBo> getChildren() {
        return children;
    }
    //添加孩子节点
    public void addChild(NodeBo child) {
        children.add(child);
    }
}
